var stepManager={
	
	// step items call thie method to register themselves into me.
	add:function(newStep){
		this.steps.push(newStep);
		var r=$('<div class="stepOuterDiv"><div class="stepTitle">'+newStep.title+'</div></div>');

		var newDiv=newStep.createUI();
		newDiv.addClass('stepInnerDiv');
		r.append(newDiv);
		
		r.appendTo($("#stepsDiv"));
	},
	steps:[],
	loadStep:function(jsFile){
		++this.desiredStepsCount;
		$.include('script/steps/'+jsFile,stepManager.onLoadStepsFinished);
	},
	loadSteps:function(){
		$.each(['ReadPhotoVideo','ChooseRepository','ReadGPSLog','FixExifData','Convert3gpToAvi','HandleVideoFiles','UploadToPicasaWeb'],function(){
			stepManager.loadStep(this+'.js');
		});
	},

	loadedStepsCount:0,
	desiredStepsCount:0,

	onLoadStepsFinished:function(){
		
		if(++stepManager.loadedStepsCount>=stepManager.desiredStepsCount){
			//all steps are loaded
			$.each(stepManager.steps,function(){
				
				if(this.postCreateUI)
					this.postCreateUI();
			});
		}
	}
};
stepManager.loadSteps();

